from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.api import users
from presenter import admindocumentpresenter
from view import baseview

class AdminDocumentView(baseview.BaseView):
  def get(self):
    if (not users.is_current_user_admin()):
        self.redirect('/')
    else:
        self.templatefile = "templates/admindocument.html"
        presenter = admindocumentpresenter.AdminDocumentPresenter(request=self.request, currentuser=users.get_current_user(), view=self)
        presenter.respondToGet()

application = webapp.WSGIApplication(
                                     [('/admindocument', AdminDocumentView)],
                                     debug=True)

def main():
  run_wsgi_app(application)

if __name__ == "__main__":
  main()